﻿using Ecommerce.API.Application.Command.LeaveCommand;
using Ecommerce.Domain.Holiday;
using Ecommerce.Services.Leaves;
using MediatR;

namespace Ecommerce.API.Application.CommandHandlers.LeaveHandler
{
    public class LeaveAddCommandHandler : IRequestHandler<LeaveAddCommand, int>
    {
        private readonly ILeaveServices services;

        public LeaveAddCommandHandler(ILeaveServices services)
        {
            this.services = services;
        }

        public Task<int> Handle(LeaveAddCommand request, CancellationToken cancellationToken)
        {
            return services.Addleave(new Leave() { Lid = request.Lid, Lname = request.Lname, Pid = request.Pid, LType = request.LType, Qtime = request.Qtime, QWhy = request.QWhy,DTime=request.DTime,Btime=request.Btime,BName=request.BName });
        }
    }
}
